#pragma once
#include "DXAMLCommon.h"




#define MAX_ERROR_PARAMS_COUNT 2
class ParserErrorReporter
{
public: 
	ParserErrorReporter();
	virtual ~ParserErrorReporter();
	void Initialize();
	XBOOL IsErrorRecorded() const;
	void SetIsErrorRecorded(XBOOL bIsErrorRecorded);
	HRESULT SetError(XUINT32 iErrorCode, XUINT32 uLine, XUINT32 uColumn, const xshared_ptr<CXString> & pstrParam1, const xshared_ptr<CXString> & pstrParam2);
	HRESULT SetError(XUINT32 iErrorCode, XUINT32 uLine, XUINT32 uColumn, const xshared_ptr<CXString> & pstrParam1);
	HRESULT SetError(XUINT32 iErrorCode, XUINT32 uLine, XUINT32 uColumn, XUINT32 pstrParam1);
	HRESULT SetErrorWithMessage(XUINT32 iErrorCode, XUINT32 uLine, XUINT32 uColumn, XUINT32 bRecoverable, xshared_ptr<CXString> & spMessage);
protected: 
	virtual HRESULT ReportError(XUINT32 iErrorCode, XUINT32 uLine, XUINT32 uColumn, XUINT32 uParamCount, XBOOL bRecoverable, xshared_ptr<CXString> & spMessage) = 0;
private: 
	HRESULT LoadAdjustedStringBuffer(const xshared_ptr<CXString> & inssErrorString, XUINT32 uParamIndex);
protected: 
	static const XUINT32 MAX_ERROR_PARAMS;
	XBOOL m_bErrorRecorded;
	struct XSTRING * m_ErrorParams[MAX_ERROR_PARAMS_COUNT];
};
